package com.smallcc.controller;

import com.smallcc.service.SeckillService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 晓风过境
 * @TODO    秒杀测试
 * @date 2018/4/4 20:20
 * @day 04
 * @return $text$
 * @title ${CLASS_NAME}
 * @project_name sell
 */
@RestController
@Slf4j
@RequestMapping("/skill")
public class SecKillController {
    @Autowired
    private SeckillService seckillService;

    /**
     * 查询秒杀活动特价商品信息
     * @param productId
     * @return
     */
    @GetMapping("/query/{productId}")
    public String query(@PathVariable String productId){
        return seckillService.querySeckillProductInfo(productId);

    }
    @GetMapping("/order/{productId}")
    public String skill (@PathVariable String productId){
        log.info("@skill request,productId:"+productId);
        seckillService.orderProductMockDiffUser(productId);
        return seckillService.querySeckillProductInfo(productId);

    }

}
